#{extends 'main.html' /}
#{set title:'Home' /}
<div style="text-align:center;"><h1>Lato server API test page</h1></div>

<h2>Catalog interface:</h2>
  <ul>
   <li><code>String getCatalogs(String userId);</code>
   <p>Route: GET /catalogs/{userId}
   <p>test URL: <a href="http://localhost:9000/catalogs/1">http://localhost:9000/catalogs/1</a>
   <p>get a catalog list by userId 
   
   <li><code>String deleteCatalogs(String catalogsId);</code>
   <p>Route: POST     /delcatalog
   <p>Params: catalogId
   <div style='background:#ccc;'>test Form:
   <form action="/delcatalog" method="post">
   catalogId:<input type='text' name='catalogId' value='0'>
   <input type='submit' value='delete'></form></div>
   <p>delete the catalog, if return string length=0 means delete successfully, if return string length>0 means delete fails and string is the err msg.
   <li><code>String saveCatalog(String catalogJson);</code>
   <p>Route: POST    /catalog
   <p>Params: catalogJson
   <div style='background:#ccc;'>test Form:<form  action="/catalog" method="post">
   catalogJson:<input type='text' size=150 name='catalogJson' value='[{"ID":0,"Caption":"cat2rew","ParentID":"1","Index":"1"},{"ID":0,"Caption":"cat3ewrew","ParentID":"1","Index":"2"}]'>
   <input type='submit' value='save'></form></div>
   <p>if categoryId>0 means update catalog, otherwise will create catalog.
   </ul>

<hr>
  <h2>Template interface:</h2>
  <ul>
   <li><code>boolean checkTableNameExist(String tableName);</code>
   <p>Route: GET /template/exist/{tableName}
   <p>test URL: <a href="http://localhost:9000/template/exist/GateInOrder">http://localhost:9000/template/exist/GateInOrder</a>
   <p>check if TableName exist
   
   <li><code>String getTemplateList(String categoryId);</code>
   <p>Route: GET     /templates/{categoryId}
   <p>test URL: <a href="http://localhost:9000/templates/1">http://localhost:9000/templates/1</a>
   <p>get the template list json by categoryId
   <li><code>String getTemplate(String templateId);</code>
   <p>Route: GET     /template/{templateId}
   <p>test URL: <a href="http://localhost:9000/template/1">http://localhost:9000/template/1</a>
   <p>get the template json
   <li><code>String getTemplateFile(String templateId);</code>
   <p>Route: GET     /template/stylefile/{templateId}
   <p>test URL: <a href="http://localhost:9000/template/stylefile/6">http://localhost:9000/template/stylefile/6</a>
   <p>get the template json
   <li><code>String deleteTemplate(String templateId);</code>
   <p>Route:POST    /deltemplate/{templateId}  
   <p>Route: DELETE     /template/{templateId}
   <p>test URL: can not test by GET
   <p>delete the template, if return string length=0 means delete successfully, if return string length>0 means delete fails and string is the err msg.
   <li><code>String saveTemplate(String json, File file, String catalogId);</code>
   <p>Route: POST    /template
   <div style='background:#ccc;'>save template:
	<form action="template" method="post" enctype="multipart/form-data">
	 Templatejson:{
   "tableMapList":[
      {
         "deletedFieldList":[

         ],
         "isVertDisplay":true,
         "modifiedFieldList":{

         },
         "fieldMapList":[
            {
               "defValue":"",
               "isFilled":false,
               "caption":"name",
               "name":"",
               "type":0,
               "col":3,
               "row":2
            },
            {
               "defValue":"",
               "isFilled":false,
               "caption":"age",
               "name":"",
               "type":0,
               "col":5,
               "row":2
            }
         ],
         "newFieldList":[
            "name",
            "age"
         ],
         "tableCaption":"MasterTable",
         "isAllowExtendData":false,
         "gridRange":"",
         "tableName":"MasterTable"
      }
   ],
   "templateCode":"leo1",
   "templateName":"leo1",
   "templateId":""
}
	  <p>template json: <input type="text" size=120 name="json" value='{
   "tableMapList":[
      {
         "deletedFieldList":[

         ],
         "isVertDisplay":true,
         "modifiedFieldList":{

         },
         "fieldMapList":[
            {
               "defValue":"",
               "isFilled":false,
               "caption":"name",
               "name":"",
               "type":0,
               "col":3,
               "row":2
            },
            {
               "defValue":"",
               "isFilled":false,
               "caption":"age",
               "name":"",
               "type":0,
               "col":5,
               "row":2
            }
         ],
         "newFieldList":[
            "name",
            "age"
         ],
         "tableCaption":"MasterTable",
         "isAllowExtendData":false,
         "gridRange":"",
         "tableName":"MasterTable"
      },{
         "deletedFieldList":[

         ],
         "isVertDisplay":true,        
         "fieldMapList":[
            {
               "defValue":"",
               "isFilled":false,
               "caption":"item",
               "name":"",
               "type":0,
               "col":3,
               "row":2
            },
            {
               "defValue":"",
               "isFilled":false,
               "caption":"itemNo",
               "name":"",
               "type":0,
               "col":5,
               "row":2
            }
         ],       
         "tableCaption":"SlaveTable",
         "isAllowExtendData":false,
         "gridRange":"",
         "tableName":"SlaveTable"
      }
   ],
   "templateCode":"leo1",
   "templateName":"leo1",
   "templateId":""
}'/></p>
	  <p>template file: <input type="file" name="file" /></p>
	  <p>catalogId: <input type="text" name="catalogId" value="1"/></p>
	  <input type="submit" value="Submit" />
	</form>
	</div>
   <p>if templateId>0 means update template, otherwise will create template.
   <li><code>DynaBean getTableDefineBean(String tableName)</code>
   <p>Route: GET /template/table/{tableName}
   <div style='background:#ccc;'>test Form:
   <form action="template/table" method="get">
   table name:<input type='text' name='tableName' value='主表1'>
   <input type='submit' value='get'></form></div>
   </ul>
<hr>
  <h2>Form interface:</h2>
  <ul>
   <li><code>String getForms(String templateId);</code>
   <p>route: GET /forms/{userId}
   <p>test URL: <a href="http://localhost:9000/forms/1">http://localhost:9000/forms/1</a>
   <p>get Form List by templateId, return form list in json format.
   <li><code>String getForm(String formId);</code>
   <p>route: GET /form/{formId}
   <p>test URL: <a href="http://localhost:9000/form/1">http://localhost:9000/form/1</a>
   <p>get the Form by formId, return form data in json format.
   <li><code>String deleteForm(String formId);</code>
   <p>route: DELETE     /form/{formId}  <span style="color:red;">not implement yet.</span>
   <p>route: POST       /form/del/{formId}
   <p>Params: formId
   <div style='background:#ccc;'>test Form:
   <form action="form/del" method="post" >
   <input type='text' name='formId' value='formId'>
   <input type='submit' value='delete'></form></div>
   <p>delete the form, if return string length=0 means delete successfully, if return string length>0 means delete fails and string is the err msg.
   <li><code>String saveForm(String formJson);</code>
    <p>route: POST    /form
   <div style='background:#ccc;'>test Form:
   <form METHOD ='post' action='form'>
   Templatejson:{		
		"Version":"",
	 	"templateId":"模板ID",	 	
	 	"templateName":"模板名",
	  "filePath":"模板文件路径标识",
	  "formsID":"定单ID",	
	  "userID":"用户ID",
	 	"tableDefines":
								 	[
								 		{	"tableName":"表名",
								 			"defineArea":"定义区域",
								 			"isVertDisplay":"水平垂直",
								 			"fieldList":[	 	
																						 		 	{"caption":"显示名","name":"字段名","type":"类型字符","cellRef":"表格引用"},
																									{"caption":"显示名","name":"字段名","type":"类型字符","cellRef":"表格引用"}	
																									]																	
										},		
								 		{"tableName":"表名","fieldList":[	 	
																						 		 			{"caption":"显示名","name":"字段名","type":"类型字符"},
																											{"caption":"显示名","name":"字段名","type":"类型字符"}	
																										]																	
										}										
								 	]	,
	
		"dataTableList":
							[
							 	{"tableName":"MasterTable", 								 	
						 		"fieldList":["ID", "orderNo", "intype"],						 		
							 	"valueList":[["0",	"customerName", "orderNo"],
							 				 ["0",	"customerName", "orderNo"]
							 				],
								"delValueList":["","",""]
								},
								{"tableName":"SlaveTable", 								 	
						 		"fieldList":["id", "item", "itemNo"],						 		
							 	"valueList":[["0",	"item001", "itemNo001"],
							 				 ["0",	"item002", "itemNo002"]
							 				],
								"delValueList":["","",""]
								}								
							]	
}
   <p>formJson:<input type='text' size=120 name='formJson' value='{		
		"Version":"",
	 	"templateId":"1",	 	
	 	"templateName":"模板名",
	  "filePath":"模板文件路径标识",
	  "formsID":"定单ID",	
	  "userID":"用户ID",
	 	"tableDefines":
								 	[
								 		{	"tableName":"表名",
								 			"defineArea":"定义区域",
								 			"isVertDisplay":"水平垂直",
								 			"fieldList":[	 	
																						 		 	{"caption":"显示名","name":"字段名","type":"类型字符","cellRef":"表格引用"},
																									{"caption":"显示名","name":"字段名","type":"类型字符","cellRef":"表格引用"}	
																									]																	
										},		
								 		{"tableName":"表名","fieldList":[	 	
																						 		 			{"caption":"显示名","name":"字段名","type":"类型字符"},
																											{"caption":"显示名","name":"字段名","type":"类型字符"}	
																										]																	
										}										
								 	]	,
	
		"dataTableList":
							[
							 	{"tableName":"MasterTable", 								 	
						 		"fieldList":["id", "name", "age"],						 		
							 	"valueList":[["0",	"customerName", "orderNo"],
							 				 ["0",	"customerName", "orderNo"]
							 				],
								"delValueList":["","",""]
								},
								{"tableName":"SlaveTable", 								 	
						 		"fieldList":["id", "item", "itemNo"],						 		
							 	"valueList":[["0",	"item001", "itemNo001"],
							 				 ["0",	"item002", "itemNo002"]
							 				],
								"delValueList":["","",""]
								}			
							]
}'>
   <input type='submit' value='save'></form></div>
   <p>if formId>0 means update form, otherwise will create form.
   </ul>
   
   